//
//  NSString+Extention.m
//  联付商圈
//
//  Created by 韩佳睿 on 2017/8/22.
//  Copyright © 2017年 lianfu. All rights reserved.
//

#import "NSString+Extention.h"

@implementation NSString (Extention)

+ (BOOL)isNilOrEmpty:(NSString *)aNSString
{
    return [aNSString isKindOfClass:[NSNull class]] || !aNSString || aNSString.length == 0;
}

+ (NSString *)getNowTimeTimestamp{
    
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init] ;
    
    [formatter setDateStyle:NSDateFormatterMediumStyle];
    
    [formatter setTimeStyle:NSDateFormatterShortStyle];
    
    [formatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"]; // ----------设置你想要的格式,hh与HH的区别:分别表示12小时制,24小时制
    
    //设置时区,这个对于时间的处理有时很重要
    
    NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Shanghai"];
    
    [formatter setTimeZone:timeZone];
    
    NSDate *datenow = [NSDate date];//现在时间,你可以输出来看下是什么格式
    
    NSString *timeSp = [NSString stringWithFormat:@"%ld", (long)[datenow timeIntervalSince1970]*1000];
    
    return timeSp;
}

@end
